import { IPSDETreeStaticNode } from './ipsdetree-static-node';
import { PSDETreeNodeImplBase } from './psdetree-node-impl-base';
import { IPSLanguageRes } from '../../res/ipslanguage-res';

export class PSDETreeStaticNodeImpl extends PSDETreeNodeImplBase implements IPSDETreeStaticNode {
  get nodeValue(): string {
    return this.M.nodeValue;
  }

  get text(): string {
    return this.M.text;
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  protected tooltippslanguageres: IPSLanguageRes | null = null;

  getTooltipPSLanguageRes(): IPSLanguageRes | null {
    if (this.tooltippslanguageres != null) return this.tooltippslanguageres;
    const value = this.M.getTooltipPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.tooltippslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getTooltipPSLanguageRes') as IPSLanguageRes;
    return this.tooltippslanguageres;
  }

  get tooltipPSLanguageRes(): IPSLanguageRes | null {
    return this.getTooltipPSLanguageRes();
  }

  getTooltipPSLanguageResMust(): IPSLanguageRes {
    const value = this.getTooltipPSLanguageRes();
    if (value == null) {
      throw new Error('未指定提示语言资源');
    }
    return value;
  }

  get cls(): string {
    return 'PSDETreeStaticNodeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.tree.IPSDETreeStaticNode') return true;
    return super.instanceof(cls);
  }
}
